import { createRouter, createWebHistory } from 'vue-router';
import LoginPage from '../views/login/LoginPage.vue';
import HomePage from '../views/common/HomePage.vue';
import EmployeePage from '../views/page/EmployeePage.vue';
import GoodsPage from '../views/page/GoodsPage.vue';
import pay_detailPage from '../views/page/pay_detailPage.vue';
import customerPage from '../views/page/customerPage.vue';
import PurchasingMasterPage from '../views/page/PurchasingMasterPage.vue';


const routes = [
    {
        path: '/',
        redirect: '/login' // 默认重定向到登录页
    },
    {
        path: '/login',
        name: 'LoginPage',
        component: LoginPage,
    },
    {
        path: '/home',
        name: 'HomePage',
        component: HomePage,
        children: [
            {
                path: '/employ',
                name: 'EmployeePage',
                component: EmployeePage,
                meta: { title: '员工管理', link: true }
            },
            {
                path: '/goods',
                name: 'GoodsPage',
                component: GoodsPage,
                meta: { title: '商品管理', link: true }
            },
            {
                path: '/pay_detail',
                name: 'pay_detailPage',
                component: pay_detailPage,
                meta: { title: '采购明细', link: true }
            },
            {
                path: '/customer',
                name: 'customerPage',
                component: customerPage,
                meta: { title: '顾客管理', link: true }
            },
            {
                path: '/purchasingMaster',
                name: 'PurchasingMasterPage',
                component: PurchasingMasterPage,
                meta: { title: '采购主表', link: true }
            },
        ]
    },
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
});

export default router;
